package Employeess;

import java.util.ArrayList;

public class EmployeeMgr {
    public static void main(String[] args) {
        Employee employee1 = new Employee(1, "张三", 18, 3000);
        Employee employee2 = new Employee(2, "lisi", 25, 3500);
        Employee employee3 = new Employee(3, "wangwu", 22, 3200);

        ArrayList list=new ArrayList();
        list.add(employee1);
        list.add(employee2);
        list.add(employee3);
        //插入
        Employee employee4=new Employee(4,"zhaoliu",24,3300);

        list.add(1, employee4);
        //删除wangwu

            int index=-1;
            for (int i=0;i<list.size();i++){
                Employee employee= (Employee) list.get(i);
                if ("wangwu.".equals(employee.getName())){
                    index=i;
                    break;
                }

            if (index!=-1){
                list.remove(index);

            }
        }
        //遍历输出所有工人信息
        for (int i=0;i<list.size();i++){
            Employee employee= (Employee) list.get(i);
            System.out.println(employee.getId()+employee.getName()+employee.getAge()+employee.getSalay());
        }
    }

}